//
//  PKPayCartViewControllerCell.swift
//  Panku
//
//  Created by mac on 2017/5/28.
//  Copyright © 2017年 Monster. All rights reserved.
//

import UIKit

class PKPayCartViewControllerCell: PKBaseTableViewCell {
    
    //MARK: - UI
    lazy var selectButton = PKBaseButton.createButton()
    lazy var displayView = UIImageView()
    lazy var titleLabel = UILabel()
    lazy var colorLabel = UILabel()
    lazy var priceLabel = UILabel()
    lazy var amountStepper = UIStepper()
    
    override func setupCell() {
        contentView.addSubview(selectButton)
        contentView.addSubview(displayView)
        contentView.addSubview(titleLabel)
        contentView.addSubview(colorLabel)
        contentView.addSubview(priceLabel)
        contentView.addSubview(amountStepper)
        
        selectButton.setImage(R.image.pay_cart_selected(), for: .selected)
        
        titleLabel.textColor = UIColor(hexString: "282828")
        titleLabel.font = UIFont.PKFont(Size: 18)
        
        colorLabel.textColor = UIColor(hexString: "323232")
        colorLabel.font = UIFont.PKFont(Size: 16)
        
        priceLabel.textColor = UIColor(hexString: "272727")
        priceLabel.font = UIFont.PKFont(Size: 16)
        
        amountStepper.autorepeat = false
        amountStepper.minimumValue = 1
        amountStepper.maximumValue = 10
        
        selectButton.snp.makeConstraints { (make) in
            make.centerY.equalTo(contentView.snp.centerY)
            make.left.equalTo(contentView.snp.left).offset(12)
            make.width.equalTo(15)
            make.height.equalTo(15)
        }
        
        displayView.snp.makeConstraints { (make) in
            make.top.equalTo(contentView.snp.top).offset(12)
            make.left.equalTo(selectButton.snp.right).offset(12)
            make.height.equalTo(80)
            make.height.equalTo(80)
        }
        
        titleLabel.snp.makeConstraints { (make) in
            make.left.equalTo(displayView.snp.right).offset(12)
            make.top.equalTo(displayView.snp.top)
        }
        
        colorLabel.snp.makeConstraints { (make) in
            make.left.equalTo(titleLabel.snp.left)
            make.top.equalTo(titleLabel.snp.bottom).offset(10)
        }
        
        priceLabel.snp.makeConstraints { (make) in
            make.left.equalTo(titleLabel.snp.left)
            make.bottom.equalTo(displayView.snp.bottom)
        }
        
        amountStepper.snp.makeConstraints { (make) in
            make.right.equalTo(contentView.snp.right).offset(12)
            make.bottom.equalTo(displayView.snp.bottom)
        }
        
        
    }
}
